from configparser import ConfigParser
from config.VarConfig import pageElementLocatorPath


class ParseConfigFile:
    def __init__(self):
        self.cf = ConfigParser()
        self.cf.read(pageElementLocatorPath,encoding='utf-8')

    def getItemSection(self,sectionName):
        optionDict = dict(self.cf.items(sectionName))
        return optionDict

    def getOptionValue(self,sectionName,optionName):
        value = self.cf.get(sectionName,optionName)
        return value



if __name__ == '__main__':
    test = ParseConfigFile()
    dict1 = test.getItemSection("126mail_login")
    print(dict1)
    value = test.getOptionValue("126mail_login","loginpage.username")
    print(value)